package com.dong.common;

import java.io.Serializable;

public class ResultData<T extends Serializable> extends Result {
    private T data;

    public ResultData(Integer code, String msg, T data) {
        super(code, msg);
        this.data = data;
    }

    public static <T extends Serializable> ResultData<T> success(T data) {
        return new ResultData<T>(ResultCode.SUCCESS.code, ResultCode.SUCCESS.desc, data);
    }

    public T getData() {
        return data;
    }

    public void setData(T data) {
        this.data = data;
    }

    @Override
    public String toString() {
        return "ResultData{" +
                "code=" + super.getCode() +
                "msg=" + super.getMsg() +
                "data=" + data +
                '}';
    }
}
